home *** CD-ROM | disk | FTP | other *** search
- Path: an158.du.pipex.com!alanshepherd
- From: alanshepherd@online.rednet.co.uk (Alan Shepherd)
- Newsgroups: comp.lang.c++
- Subject: MSVC 1.5 problem using CString class and fstream
- Date: Thu, 28 Mar 1996 10:16:48
- Organization: Link Technology Ltd
- Message-ID: <alanshepherd.28.000A4801@online.rednet.co.uk>
- NNTP-Posting-Host: an158.du.pipex.com
- X-Newsreader: Trumpet for Windows [Version 1.0 Rev A]
-
- Hello I am a newby to C++, MSVC and this group so please forgive if this
- question is naive or has been posted previously.
-
- I am having problems in two areas and I suspect they are related. The first
- occours when I tried to write a simple C++ program using CString types. A
- simple quickwin example is shown below.
-
- #include <iostream.h>
- #include<afx.h>
-
- int CStringfunc( CString&, CString&);
-
- CString line = "this is a test of CStringfunc";
- CString word = "test";
-
- void main()
- {
- int i = CStringfunc(line,word);
- cout << " i = " << i << '\n';
- }
- .
- definition of CStringfunc etc.
- .
-
- The code compiles ok but the linker complains that .."mlibcew(delete.cxx) :
- error l2044: void __far __cdecl operator delete(void __near*) symbol multiply
- defined" followed by some advice on relinking with /NOE (which also does not
- work. The same message is repeated for "operator new"
-
- this is followed by a list of L2029 errors (unresolved externals) including;
- GETFILETITLE...DRAGACCEPTFILES...CHOOSECOLOR etc. I have experimented with
- including various libraries in the link options with no sucess. Any sugestions?
-
- The second problem is similar but comes at it from the oposite direction. In
- this case I wish to use <fstream.h> in my appwizzard generated widows program.
- I wanted to do some simple text file i/o and thought the fstream class gave
- better service than the CStdiofile class. The work was just some anciliary
- bookkeeping and so I didnt want to go the serialise/archive route. I include
- the header file references for example
-
- #include "stdafx.h"
- #include "appro.h"
- #include "project.h"
- #include "logon.h"
-
- #include "fstream.h"
- #include "direct.h"
- #include "sys\types.h"
- #include "sys\stat.h"
- .
- .
- Again the code compiles ok but does not link with exactly the same L2044 error
- on the 'new' and 'delete' operators. I have written a seperate small program
- using fstream it works fine UNTILL I include <afx.h>. Are these seperate ways
- of working incompatable or am I doing something wrong? I cant seem to use the
- CString class outside the application framework or the fstream class within.
- If anyone else has had similar problems to this or any advice at all I would
- be greatful to hear from them.
-
- alanshepherd@online.rednet.co.uk
-
-
-